package com.leyou.pojo.dto;

import com.leyou.common.dto.BaseDTO;
import com.leyou.common.entity.BaseEntity;
import com.leyou.common.utils.BeanHelper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class SpecGroupDto extends BaseDTO implements Serializable {
    private Long id;
    private Long categoryId;
    private String name;

    private List<SpecParamDto> list;

    public <T> T toEntity(Class<T> entityClass) {
//        BeanUtils.copyProperties(this,entityClass);
        T t = BeanHelper.copyProperties(this, entityClass);
        return t;

    }

    public SpecGroupDto(BaseEntity entity) {
        super(entity);
    }
}
